package com.zgjkhis.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author yzq
 * @Description 药品流转
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_drug_circulation")
public class DrugCirculation implements Serializable {

    @TableId
    private Long id;
    @ApiModelProperty(value = "来自门店id",required = true)
    @NotNull(message = "来自门店id不能为空")
    private Long fromStoreId;
    @ApiModelProperty(value = "来自门店名称",required = true)
    @NotNull(message = "来自门店名称不能为空")
    private String fromStoreName;
    @ApiModelProperty(value = "来自药品id",required = true)
    @NotNull(message = "来自药品id不能为空")
    private Long fromDrugId;
    @ApiModelProperty(value = "来自药品名称",required = true)
    @NotNull(message = "来自药品名称不能为空")
    private String fromDrugName;
    @ApiModelProperty(value = "流转门店id",required = true)
    @NotNull(message = "流转门店id不能为空")
    private Long toStoreId;
    @ApiModelProperty(value = "流转门店名称",required = true)
    @NotNull(message = "流转门店名称不能为空")
    private String toStoreName;
    @ApiModelProperty(value = "流转药品id",required = true)
    @NotNull(message = "流转药品id不能为空")
    private Long toDrugId;
    @ApiModelProperty(value = "流转药品名称",required = true)
    @NotNull(message = "流转药品名称不能为空")
    private String toDrugName;
    @ApiModelProperty(value = "0:正常，1：失效，-1：删除",required = true)
    @NotNull(message = "状态不能为空")
    private Integer status;
    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;
    @ApiModelProperty(value = "状态：0：正常，1：无效")
    private String createUserId;
    @ApiModelProperty(value = "状态：0：正常，1：无效")
    private String createUser;

    public void copy(DrugCirculation source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
